<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<title>角色编辑 - 个人中心 - IT答案网</title>
<meta name="keywords" content="角色编辑 " />
<meta name="description" content="角色编辑 " />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${path }/css/all.css?version=${version}" rel="stylesheet">
<link href="${path }/css/prettify.css?version=${version}" rel="stylesheet">
</head>
<body>
  <jsp:include page="head.jsp"></jsp:include>
  <div class="container container1000">
	<div class="content">
		<form class="form-horizontal" method="post" action="${ctx }/user/role/save">
			<input type="hidden" name="id" value="${role.id}"/>
		
			<div class="control-group">
				<label class="control-label">角色名</label>
				<div class="controls">
					<input type="text"  name="name" value="${role.name }" <shiro:lacksRole name="admin">disabled="disabled"</shiro:lacksRole>>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">显示顺序</label>
				<div class="controls">
					<input type="text"  name="rank" value="${role.rank }" <shiro:lacksRole name="admin">disabled="disabled"</shiro:lacksRole>>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">拥有权限</label>
				<div class="controls">
					<table class=" table-bordered table-striped table-condensed">
							<thead>
								<tr>
									<th>
										<input type="checkbox" id="selectall" onChange="selectAll('selectall','permissionIds');" <shiro:lacksRole name="admin">disabled="disabled"</shiro:lacksRole>>
									</th>
									<th>
									    权限名称
									</th>									
								</tr>
							</thead>
							<tbody>							
								<c:forEach items="${permissions}" var="data" >
								<c:set value="" var="checked"/>
								<tr>
									<c:forEach items="${permissionIds }" var="innerData">
									    <c:if test="${innerData==data.id}">
									      <c:set value="checked" var="checked"/>
									    </c:if>
									</c:forEach>
									<td><input type="checkbox" name="permissionIds" value="${data.id}" ${checked } <shiro:lacksRole name="admin">disabled="disabled"</shiro:lacksRole>></td>
									<td>${data.name}</td>
								</tr>
								</c:forEach>
							</tbody>
						</table>
				</div>
			</div>
			<shiro:hasRole name="admin">
			<div class="control-group">
				<div class="controls">
					<input type="submit" class="btn" value="保存">
				</div>
			</div>
			</shiro:hasRole>
		</form>
	 <br/>
	</div>
 </div>
  <script src="${ctx}/js/common.js"></script>
  <div class="clear">&nbsp;</div>
  <jsp:include page="bottom.jsp"></jsp:include>  
</body>
</html>	